"""system_back URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path, include
from django.views.generic import RedirectView
from django.views.static import serve

from User import views as user_views
from Shop import views as shop_views
from Payment import views as pay_views
from django.conf.urls.static import static
from Shop import recommendation as recommend_views
from system_back import settings
urlpatterns = [
    #用户接口
    path('admin/', admin.site.urls),
    path('login/', user_views.Login),
    path('register/', user_views.Register),
    path('send_email/', user_views.send_email),
    path('modifypwd/', user_views.ModifyPassword),
    path('updateUser/', user_views.updateUser),
    path('uploadAvatar/', user_views.uploadAvatar),
    path('getCount/', user_views.getCount),
    # 商品展示接口
    path('listProducts/',shop_views.listProducts),
    path('showProduct/',shop_views.showProduct),
    path('showPictures/',shop_views.showPictures),
    path('recommendGoods/',shop_views.test),
    path('pictureSearch/',shop_views.pictureSearch),
    # 地址接口
    path('addAddress/',shop_views.addAddress),
    path('getAddress/',shop_views.getAddress),
    path('updateAddress/',shop_views.updateAddress),
    path('deleteAddress/',shop_views.deleteAddress),

    # 订单接口
    path('createorder/',shop_views.createOrder),
    path('AllProducts/',shop_views.GetAllProducts),
    path('SortProducts/',shop_views.SortProducts),

    path('add/', shop_views.Save_commodity),
    path('searchGoods/', shop_views.searchGoods),
    path('test/', shop_views.test),



    # 购物车接口
    path('addCart/', shop_views.addCart),
    path('updateCart/', shop_views.updateCart),
    path('deleteCart/', shop_views.deleteCart),
    path('showCart/', shop_views.showCart),

    #收藏夹接口
    path('addFavorite/', shop_views.addFavorite),
    path('showFavorites/', shop_views.showFavorites),
    path('deleteFavorite/', shop_views.deleteFavorite),

    #支付接口
    path('AliPay/',pay_views.get_alipay),
    path('addPayment/', pay_views.create_payment_with_order),
    path('deletePayment/', pay_views.delete_payment_and_detach_order),
    path('updatePayment/', pay_views.update_payment_order),
    path('getOrderid_fromPayment/', pay_views.get_order_id_from_payment),
    path('getTimestamp/', pay_views.get_payment_timestamp),
    path('updateTimestamp/', pay_views.update_payment_timestamp),
    path('getPaymentmethod/', pay_views.get_payment_method),
    path('updatePaymentmethod/', pay_views.update_payment_method),
    path('paymentRecords/', pay_views.get_payment_records),

#订单接口
    path('createOrder/', shop_views.createOrder),
    path('showOrder/',shop_views.GetPayOrders),
    path('showOrderDetail/',shop_views.GetOrderDetail),
    path('getUaddress/',shop_views.GetDetailAddress),
    path('deleteOrder/',shop_views.changeOrder),
    path('exitOrder/',shop_views.exitOrder),
    path('CompleteOrder/',shop_views.CompleteOrder),
path('favicon.ico', RedirectView.as_view(url=r'static/favicon.ico')),
path('sp/', include('simplepro.urls')),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
admin.site.site_title = '电商管理平台'

# 网站名称：显示在登录页和首页
admin.site.site_header = '电商管理平台'
